package com.easemob.helpdesk.widget.chatrow;

import android.app.Activity;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.easemob.helpdesk.adapter.UserChatAdapter;
import com.easemob.helpdesk.bean.MsgChat;
import com.easemob.helpdesk.emoticon.utils.SimpleCommonUtils;
import com.easemob.helpdesk.utils.CommonUtils;
import com.housekeeperapp.R;
import com.hyphenate.kefusdk.entity.HDMessage;
import com.hyphenate.kefusdk.utils.HDLog;

/**
 * Created by wsj on 2018/5/22.
 */

public class MsgTxtViewHolder extends BaseMsgViewHolder{

    public ProgressBar pb;
    public TextView tv;

    public MsgTxtViewHolder(Activity activity, UserChatAdapter chatAdapter, View itemView) {
        super(activity, chatAdapter, itemView);

//        chatAdapter.getItem()

    }

    @Override
    public void handleViewMessage(MsgChat message, int position) {
        if(!message.getType().equals("txt")){
            HDLog.e(TAG, "message is not txt view");
            return;
        }

        SimpleCommonUtils.spannableEmoticonFilter(tv, CommonUtils.convertStringByMessageText(message.getContent()));

        boolean isSend = (message.getDirect().equals("HX"));

        if(isSend){
            pb.setVisibility(View.GONE);
            ivStatus.setVisibility(View.GONE);
        }
    }

    @Override
    protected void onFindViewById() {
        pb = findViewById(R.id.pb_sending);
        tv = findViewById(R.id.tv_chatcontent);
    }


}
